﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
    public class ObjectTranslator
    {
        public static PokerTable TranlatePokerTable(Models.PokerTable pokerTable)
        {
            PokerTable dalPokerTable = new PokerTable();

            dalPokerTable.Action = pokerTable.Action.ToString();
            dalPokerTable.BetEnabled = pokerTable.TableActionButtons.BetButtonEnabled;
            dalPokerTable.CallEnabled = pokerTable.TableActionButtons.CallButtonEnabled;
            dalPokerTable.CheckEnabled = pokerTable.TableActionButtons.CheckButtonEnabled;
            dalPokerTable.RaiseEnabled = pokerTable.TableActionButtons.RaiseButtonEnabled;
            dalPokerTable.FoldEnabled = pokerTable.TableActionButtons.FoldButtonEnabled;

            dalPokerTable.CallText = pokerTable.TableActionButtons.CallButtonText;
            dalPokerTable.CheckText= pokerTable.TableActionButtons.CheckButtonText;
            dalPokerTable.BetText = pokerTable.TableActionButtons.BetButtonText;
            dalPokerTable.RaiseText = pokerTable.TableActionButtons.RaiseButtonText;
            dalPokerTable.FoldText = pokerTable.TableActionButtons.FoldButtonText;
            dalPokerTable.CallChips = pokerTable.TableActionButtons.CallButtonChips;

            dalPokerTable.HoleCards = string.Concat(pokerTable.HoleCards.FirstHoleCard.GetCardMark(),pokerTable.HoleCards.SecondHoleCard.GetCardMark());
            dalPokerTable.FlopCards = string.Concat(pokerTable.BoardCards.FlopCards.FirstFlopCard.GetCardMark(),pokerTable.BoardCards.FlopCards.SecondFlopCard.GetCardMark(),pokerTable.BoardCards.FlopCards.ThirdFlopCard.GetCardMark());
            dalPokerTable.TurnCard = pokerTable.BoardCards.TurnCard.GetCardMark();
            dalPokerTable.RiverCard = pokerTable.BoardCards.RiverCard.GetCardMark();

            dalPokerTable.TableName = pokerTable.TableName;
            dalPokerTable.TableState = pokerTable.TableState.ToString();

            dalPokerTable.HeroRate = pokerTable.HeroWinRate.ToString();
            dalPokerTable.VillianRate = pokerTable.VilliansWinRate.ToString();

            dalPokerTable.OpponentsCount = pokerTable.OpponentsCount;

            dalPokerTable.Pot = pokerTable.Pot;

            dalPokerTable.TimeStamp = DateTime.Now;

            return dalPokerTable;

        }
    }
}
